package com.whsxt.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.whsxt.domain.SysMenu;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: caoqingwen
 * @CreateTime: 2021-03-12 16:33
 * @Description: ${Description}
 */
public interface SysMenuMapper extends BaseMapper<SysMenu> {

    @Select("SELECT t1.* FROM sys_menu t1 LEFT JOIN sys_role_menu t2 on t1.menu_id = t2.menu_id LEFT JOIN sys_user_role t3 on t2.role_id = t3.role_id WHERE t3.user_id = #{userId}  and (t1.type = 0 or t1.type = 1)")
    List<SysMenu> findMenuByUserId(@Param("userId") Long userId);
}